Add LAT_NMEA and LON_NMEA to csv styles.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Fri, 20 Aug 2004 02:57:52 +0000 (02:57 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Fri, 20 Aug 2004 02:57:52 +0000 (02:57 +0000)
gpsbabel/csv_util.c
gpsbabel/style/README.style

index 20899f080a5b445e7a0210a1be75cfc95b4c0004..6330ff33f3fb8e847ecb6e4ee8708c75b9da6677 100644 (file)
@@ -636,6 +636,9 @@ xcsv_parse_val(const char *s, waypoint *wpt, const field_map_t *fmp)
     if ( strcmp(fmp->key, "LAT_HUMAN_READABLE") == 0) {
        human_to_dec( s, &wpt->latitude, &wpt->longitude );
     } else
+    if ( strcmp(fmp->key, "LAT_NMEA") == 0) {
+       wpt->latitude = ddmm2degrees(wpt->latitude);
+    } else
     /* LONGITUDE CONVERSIONS ***********************************************/
     if (strcmp(fmp->key, "LON_DECIMAL") == 0) {
        /* longitude as a pure decimal value */
@@ -653,6 +656,9 @@ xcsv_parse_val(const char *s, waypoint *wpt, const field_map_t *fmp)
     if ( strcmp(fmp->key, "LON_HUMAN_READABLE") == 0) {
        human_to_dec( s, &wpt->latitude, &wpt->longitude );
     } else
+    if ( strcmp(fmp->key, "LON_NMEA") == 0) {
+       wpt->latitude = ddmm2degrees(wpt->longitude);
+    } else
     /* LAT AND LON CONVERSIONS ********************************************/
     if ( strcmp(fmp->key, "LATLON_HUMAN_READABLE") == 0) {
        human_to_dec( s, &wpt->latitude, &wpt->longitude );
@@ -950,6 +956,9 @@ xcsv_waypt_pr(const waypoint *wpt)
        if (strcmp(fmp->key, "LAT_HUMAN_READABLE") == 0) {
            dec_to_human( buff, fmp->printfc, "SN", wpt->latitude );
        } else
+       if (strcmp(fmp->key, "LAT_NMEA") == 0) {
+               sprintf(buff, fmp->printfc, degrees2ddmm(wpt->latitude));
+       } else
 
         /* LONGITUDE CONVERSIONS*********************************************/
         if (strcmp(fmp->key, "LON_DECIMAL") == 0) {
@@ -982,6 +991,9 @@ xcsv_waypt_pr(const waypoint *wpt)
            dec_to_human( buff+strlen(buff), fmp->printfc, "WE", 
                            wpt->longitude );
        } else
+       if (strcmp(fmp->key, "LON_NMEA") == 0) {
+               sprintf(buff, fmp->printfc, degrees2ddmm(wpt->longitude));
+       } else
 
         /* DIRECTIONS *******************************************************/
         if (strcmp(fmp->key, "LAT_DIR") == 0) {
index e8bdb047ee32f8df6d4a0c1029c89100dd831aa0..b013e04ce6d8921782d5b340792e541ea55f3199 100644 (file)
@@ -290,6 +290,18 @@ The fields used by the XCSV parser are as follows:
             to the letter "n" in "min" and the letter "e" in "deg."
    example: IFIELD LAT_HUMAN_READABLE,"","%d %d %f%c" (writes 31 40 00.000N)
 
+ o LAT_NMEA
+   Defines the latitude in the format used by the NMEA standard which is
+   degrees multiplied by 100 plus decimal minutes.
+
+   example: IFIELD  LAT_NMEA, "%f", "%08.3f"   (writes  3558.322)
+
+ o LON_NMEA
+   Defines the longitude in the format used by the NMEA standard which is
+   degrees multiplied by 100 plus decimal minutes.
+
+   example: IFIELD  LON_NMEA, "%f", "%010.3f"   (writes -08708.082)
+
  o LON_HUMAN_READABLE
    See LAT_HUMAN_READABLE except LON_HUMAN_READABLE defines LONGITUDE.